<html>
<head>
<script type="text/javascript" src="scripts/prototype.js"></script>
<script type="text/javascript" src="scripts/ws.js"></script>
<script type="text/javascript" src="scripts/wsa.js"></script>
<script type="text/javascript" src="scripts/wsrf.js"></script>
<script type="text/javascript">
var ADDRESS = 'http://localhost:9080/SoapAjax2/Echo'

function getDeviceName(deviceID, container) {
  var epr = new WSA.EndpointReference(ADDRESS);
  var epr_rp = epr.create_reference_parameters();
  epr_rp.create_child(
    new WS.QName(
      'DeviceID',
      'urn:deviceservice')).set_value(deviceID);
  var res = new WSRF.Resource(ADDRESS, epr);
  res.get_resource_property(
    new WS.QName('DeviceName','urn:deviceservice'),
    function(call,envelope) {
      $('soap').innerHTML = arguments[2].escapeHTML();
    }
  );
}
</script>
<style>
body {
  font-family: verdana;
}
#container {
  margin: 10pt;
  border: 1pt solid black;
  padding: 2pt;
}
#result {
  padding: 5pt;
  background-color: #eeeeee;
}
#soap {
  padding: 5pt;
  background-color: #eeeeee;
  font-size: 10pt;
}
</style>
</head>
<body>
<input name="deviceid" id="deviceid" />
<input value="Invoke the Web Service" 
       type="button" 
       onclick="getDeviceName($('deviceid').value,$('result'))" />
<div id="container">Result:
<div id="result">
</div>
<div id="soap">
</div>
</div>
</body>
</html>